<?php
  $yhendus=new mysqli("localhost", "if13", "ifikad", "if13_leetussa");
   if(isSet($_REQUEST["uusleht"])){
    $kask=$yhendus->prepare("INSERT INTO osalejad (nimi, perenimi, email) VALUES (?, ?, ?)");
    $kask->bind_param("sss", $_REQUEST["nimi"], $_REQUEST["perenimi"], $_REQUEST["email"]);
    $kask->execute();
    header("Location: $_SERVER[PHP_SELF]");
    $yhendus->close();
    exit();
  }
  if(isSet($_REQUEST["kustutusid"])){
    $kask=$yhendus->prepare("DELETE FROM osalejad WHERE id=?");
    $kask->bind_param("i", $_REQUEST["kustutusid"]);
    $kask->execute();    
  }
?>
<!doctype html>
<html>
  <head>
	 <title>Pidu</title>
	<h1>Peo leht</h1>
    <style type="text/css">
	#menyykiht{
         float: left;
         padding-right: 30px;
       }
       #sisukiht{
         float:left;
       }
       #jalusekiht{
         clear: left;
       }
    </style>
	<meta charset="utf-8" />
	<div id="menyykiht">
		<a href="registreerimine.html"><p>Registreerumine</p></a>
		<a href="etteasted.php"><p>Etteasted</p></a>
	</div>
	<div id="sisukiht">

  </head>
  <body>
    <div id="jalusekiht">
       
    </div>
  </body>
</html>